
pkgname=libsasl
pkgver=2.1.26
pkgrel=6
pkgdesc="Cyrus Simple Authentication Service Layer (SASL) library"
arch=('x86_64')
url="http://cyrusimap.web.cmu.edu/downloads.html#sasl"
license=('custom')
depends=('db>=4.8' 'openssl')
source=("ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-${pkgver}.tar.gz"
        'cyrus-sasl-2.1.19-checkpw.c.patch'
        'cyrus-sasl-db.patch'
        'cyrus-sasl-2.1.26-size_t.patch')
options=('!makeflags')
md5sums=('a7f4e5e559a0e37b3ffc438c9456e425'
         'e27ddff076342e7a3041c4759817d04b'
         '0658201497aad359c0d66b0ab8032859'
         'f45aa8c42b32e0569ab3d14a83485b37')

build() {
  cd cyrus-sasl-${pkgver}
  #patch -p0 -i ${srcdir}/cyrus-sasl-2.1.19-checkpw.c.patch
  #patch -p1 -i ${srcdir}/cyrus-sasl-db.patch
  patch -p1 -i ${srcdir}/cyrus-sasl-2.1.26-size_t.patch
  
  ./configure --prefix=/usr \
  	--sysconfdir=/etc \
  	--localstatedir=/var \
	--disable-anon \
	--disable-cram \
	--disable-digest \
	--disable-gssapi \
	--enable-login \
	--disable-otp \
	--enable-plain \
        --mandir=/usr/share/man
  for dir in include lib sasldb plugins utils; do
    pushd ${dir}
    make
    popd
  done
}

package() {
  cd cyrus-sasl-${pkgver}
  for dir in include lib sasldb plugins utils; do
    pushd ${dir} 
    make DESTDIR=${pkgdir} install
    popd
  done

  # install license
  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}
